package com.wzq.upms.common.utils;

/**
 * 状态码枚举类
 * 
 * @author OEasy
 *
 */
public enum ResponseCode {
	SUCC("200", "ok"), PARAM_ERR("400", "请求参数错误"), XID_INVALID("403", "xid无效,你没有权限访问"), DID_INVALID("405",
			"did无效,你没有权限访问"), NOT_FOUND("404", "请求地址不存在"), METHOD_NOT_ALLOWED("405", "http请求Method错误"), EMP("430",
					"参数为空"), EXIST("431", "数据已存在"), NOT_EXI("432", "数据不存在"), SIGN_ERR("433", "签名错误"), CAPTCHA_ERR("434",
							"验证码错误"), NOT_HAVE_THIS_USERNAME("435", "不存在这个用户名"), USER_NAME_PASSWORD_ERROR("436",
									"用户名或密码错误"), BLACK_USER_ERROR("437", "账号异常！暂被锁定"), HAVE_THIS_USERNAME("438",
											"用户名已存在"), HAVE_THIS_TIMER("439", "已设定定时器时间,请勿重复设置"), UPLAOD_IMAGE_ERROR(
													"440", "系统上传图片错误"), OLD_PASSWORD_ERROR("441",
															"旧密码错误"), CAPTCHA_INVALID("442", "验证码无效"), OUTOF_MAX_COUNT(
																	"450", "活动剩余购买数量不足"), PAY_STATUS_ERR("452",
																			"订单支付状态错误"), TRANS_FAIL("451",
																					"红包转入余额失败"), ACTIVITY_CANCEL("458",
																							"亲！本期众筹已取消，请重新选购"), ACTIVITY_OVER(
																									"453",
																									"亲！本期众筹已结束，请重新选购"), ACTIVITY_NOT_PUBLISH(
																											"456",
																											"亲！活动未发布或已取消发布，请重新选购"), USER_MAX_COUNT(
																													"457",
																													"对不起, 用户超过购买限制"), PAY_FAIL(
																															"454",
																															"支付失败"), ADD_PRAISE_CNT(
																																	"455",
																																	"已点过赞"), ERR(
																																			"500",
																																			"系统错误,请稍后再试");
	// 成员变量
	private String code;
	private String message;

	// 构造方法
	private ResponseCode(String code, String message) {
		this.code = code;
		this.message = message;
	}

	// 普通方法
	public static String getMessage(String code) {
		for (ResponseCode c : ResponseCode.values()) {
			if (c.getCode() == code) {
				return c.getMessage();
			}
		}
		return null;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
